#include "Cell.h"

Cell::Cell()
{
}

Cell::~Cell()
{
}

void Cell::Clear()
{
	objects.clear();
}

void Cell::SetPosition(unsigned int cellX, unsigned int cellY)
{
	cellPositionX = cellX;
	cellPositionY = cellY;
}

unsigned int Cell::CellX() const
{
	return cellPositionX;
}

unsigned int Cell::CellY() const
{
	return cellPositionY;
}


void Cell::Remove(GameObject* object)
{
	std::list<GameObject*>::iterator it;


	for(it = objects.begin(); it != objects.end(); ++it)
	{
		if ( (*it) == object )
		{
			objects.erase(it);
			break;
		}
	}

	
}

void Cell::Add(GameObject* object)
{
	objects.push_back(object);
}

const std::list<GameObject*>& Cell::GetObjects() const
{
	return objects;
}

std::string Cell::ToString() const
{
	
	if (objects.size() == 0)
	{
		return ".";
	}
	else if (objects.size() == 1)
	{
		return objects.front()->ToString();
	}
	else
	{
		return "X";
	}
}